<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>新闻管理系统</title>
    <link rel="stylesheet" href="/css/main.css">
</head>
<body>
<div id="header">
    <div id="top_login">
        <form method="post" th:action="@{/users/login}" th:if="${session.loginUser==null}">
            <label> 登录名 </label>
            <input type="text" name="userName" id="uname" value="" class="login_input"/>
            <label> 密&#160;&#160;码 </label>
            <input type="password" name="password" id="upwd" value="" class="login_input"/>
            <input type="submit" class="login_sub" value="登录"/>
            <label id="error"></label>
            <img src="/images/friend_logo.gif" alt="Google" id="friend_logo"/>
        </form>
<!--        <div th:if="${session.loginUser}!=null">-->
<!--            <script>alert('登录成功')</script>-->
<!--        </div>-->
        <div th:if="${session.message}!=null">
            <script>alert('登录失败，账号密码错误')</script>
        </div>

        <p th:if="${session.loginUser!=null}">
            <span>欢迎您：[[${session.loginUser.uname}]]</span>
            <a th:href="@{/news/manager}">进入控制台</a>
            <a href="/users/logout">退出</a>
        </p>
    </div>
    <div id="nav">
        <div id="logo"><img src="/images/logo.jpg" alt="新闻中国"/></div>
        <div id="a_b01"><img src="/images/a_b01.gif" alt="" style="margin-top: 12px;"/></div>
    </div>
</div>
<!-- 页面主体区域 -->
<div id="container">
    <!-- 左侧分类栏 -->
    <div class="sidebar">
        <h1><img src="/images/title_1.gif" alt="国内新闻"/></h1>
        <div class="side_list">
            <ul>
                <li th:each="news : ${newsList1}"><a th:href="@{/news/detail/}+${news.nid}"><b> [[${news.ntitle}]] </b></a></li>
            </ul>
        </div>
        <h1><img src="/images/title_2.gif" alt="国际新闻"/></h1>
        <div class="side_list">
            <ul>
                <li th:each="news : ${newsList2}"><a th:href="@{/news/detail/}+${news.nid}"><b> [[${news.ntitle}]] </b></a></li>
            </ul>
        </div>
        <h1><img src="/images/title_3.gif" alt="娱乐新闻"/></h1>
        <div class="side_list">
            <ul>
                <li th:each="news : ${newsList3}"><a th:href="@{/news/detail/}+${news.nid}"><b> [[${news.ntitle}]] </b></a></li>
            </ul>
        </div>
    </div>
    <!-- 主体区域 -->
    <div class="main">
        <div class="class_type"><img src="/images/class_type.gif" alt="新闻中心"/></div>
        <div class="content">
            <ul class="class_date">
                <li id='class_month'>
                    <a href='/' th:href="@{/index.html}"><b> 全部 </b></a>
                    <a href='#' th:href="@{/index.html(ntid=${topic.tid})}" th:each="topic : ${topicList}"><b> [[${topic.tname}]] </b></a>
                </li>
            </ul>
            <ul class="classlist" th:if="${page.getRecords().size()>0}">
                <li th:each="news : ${page.getRecords()}">
                    <a  th:href="@{/news/detail/}+${news.nid}"> [[${news.ntitle}]] </a>
                    <span th:text="${#dates.format(news.ncreateDate,'yyyy-MM-dd HH:mm:ss')}">2021-02-03 14:20:30</span>
                </li>
                <p align="right">
                    当前页数:[<span th:text="${page.current}">1</span>/<span th:text="${page.pages}">2</span>]&nbsp;
                    <span th:if="${page.current>1}" >
                        <a th:href="@{/index.html(pageNo=1,ntid=${newVo.ntid})}">首页</a>
                        <a th:href="@{/index.html(pageNo=${page.current - 1},ntid=${newVo.ntid})}">上一页</a>
                    </span>
                    <span th:if="${page.current<=1}" >
                        首页&nbsp;
                        上一页&nbsp;
                    </span>
                    <span th:if="${page.current<page.pages}">
                        <a th:href="@{/index.html(pageNo=${page.current + 1},ntid=${newVo.ntid})}">下一页</a>
                        <a th:href="@{/index.html(pageNo=${page.pages},ntid=${newVo.ntid})}">末页</a>
                    </span>
                    <span th:if="${page.current>=page.pages}">
                        下一页&nbsp;
                        末页&nbsp;
                    </span>
                </p>
            </ul>
            <p style="text-align: center;font-size: 18px;margin-top: 20px;" th:if="${page.getRecords().size()==0}">
                暂无数据
            </p>
        </div>
        <div class="picnews">
            <ul>
                <li><a href="#"><img src="/images/Picture1.jpg" width="249" alt=""/> </a><a href="#">幻想中穿越时空</a></li>
                <li><a href="#"><img src="/images/Picture2.jpg" width="249" alt=""/> </a><a href="#">国庆多变的发型</a></li>
                <li><a href="#"><img src="/images/Picture3.jpg" width="249" alt=""/> </a><a href="#">新技术照亮都市</a></li>
                <li><a href="#"><img src="/images/Picture4.jpg" width="249" alt=""/> </a><a href="#">群星闪耀红地毯</a></li>
            </ul>
        </div>
    </div>
</div>

<!-- 底部 -->
<div th:insert="common/common::index-bottom"></div>
</body>
</html>
